# -*- coding: utf-8 -*-
"""
Created on Tue May 20 22:17:29 2014

@author: Jinku Hu
"""

from xml.dom import minidom
#import requests
from lxml import etree
from urllib2 import urlopen
import StringIO
import re
from datetime import datetime
import xmltodict
import json

Tnow = datetime.now()

MatchBettingPattern = re.compile(r'.*Match Betting$')

parser = etree.XMLParser(recover=True)
#link = 'http://api.openweathermap.org/data/2.5/weather?q=Delft,nl&mode=xml'
EUFootballMatchResultLink = 'http://cachepricefeeds.williamhill.com/openbet_cdn?action=template&template=getHierarchyByMarketType&classId=46&marketSort=MR&filterBIR=N'
UKFootballMatchResultlink = 'http://cachepricefeeds.williamhill.com/openbet_cdn?action=template&template=getHierarchyByMarketType&classId=1&marketSort=MR&filterBIR=N'

OddsInXML = urlopen(UKFootballMatchResultlink).read()

OddsInDict = xmltodict.parse(OddsInXML)

OddsInJson = json.dumps(OddsInDict)


